//=============================================================================
// AvatarActionValue.as
// 
// 
// AUTHOR:            Jay Liang
// 
//                  Copyright (c) 2011 Break Media
//                              All Rights Reserved.
//                          
//=============================================================================
package values.avatar
{
import com.adobe.utils.StringUtil;

public class AvatarActionValue
{
	[Data(type="field", mapping="@key")]
	public var key:String;
	
	private var _frame:String;

	public function get frame():String
	{
		return _frame;
	}
	
	[Data(type="field", mapping="@frame")]
	public function set frame(value:String):void
	{
		_frame = value;
		var temp:Array = value.indexOf(",") > 0 ? value.split(",") : [ value ];
		for (var i:int = 0; i < temp.length; i++)
		{
			_frameArray.push(StringUtil.trim(temp[i]));
		}
	}
	
	private var _frameArray:Array = [];
	
	public function get frameArray():Array
	{
		return _frameArray;
	}
	
	public function getFrameByDirection(direction:int):String
	{
		return frameArray[ direction ];
	}
	
	[Data(type="field", mapping="@complete_func")]
	public var completeFunc:String;
	
	public function get hasCompleteFunc():Boolean
	{
		return completeFunc && completeFunc != "";
	}
}
}

